//
//  ShareRender.swift
//  testShare
//
//  Created by LiangJianle on 15/9/18.
//  Copyright (c) 2015年 LiangJianle. All rights reserved.
//

import Foundation

class ShareRender{
    
    
    static func getShareImageName() -> String{
        let shareImageName = "健小喜ico"
        return shareImageName
    }
    
    static func getWXAPPID() -> String{
        let wxAppId = "wx6c4c12362a80d26b"
        return wxAppId
    }
    
    
    
    ///分享到微信好友
    ///
    /// :param: title:微信分享的标题 content:分享图文的内容 url:点击打开的链接
    /// :returns: void
    static func shareToWechatFriend(#title:String,content:String,url:String){
        
        println("分享到微信好友\n,tile=\(title)\n,content=\(content)\n,url=\(url)\n");
        
        var ext = WXWebpageObject()
        ext.webpageUrl = url
        
        
        var message = WXMediaMessage()
        message.title = title;
        message.description = content;
        message.mediaObject = ext
        message.setThumbImage(UIImage(named: self.getShareImageName()))
        
        var req = SendMessageToWXReq()
        req.scene = Int32(WXSceneSession.value)
        req.message = message;
        
        WXApi.sendReq(req)
        
    }
    
    ///分享到微信朋友圈
    ///
    /// :param: title:微信分享的标题 url:点击打开的链接
    /// :returns: void
    static func shareToWeChatTimeline(#title:String,url:String){
        
        
        println("微信朋友圈\n,tile=\(title)\n,url=\(url)");
        
        var ext = WXWebpageObject()
        ext.webpageUrl = url
        
        
        var message = WXMediaMessage()
        
        
        message.title = title
        message.mediaObject = ext
        message.setThumbImage(UIImage(named: self.getShareImageName()))
        
        
        var req = SendMessageToWXReq()
        req.scene = Int32(WXSceneTimeline.value)
        req.message = message;
        
        WXApi.sendReq(req)
        
        
    }

}